//
//  CityTourLinePointCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2017/6/29.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "CityTourLinePointCell.h"
#import "RecordListDAO.h"
@implementation CityTourLinePointCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.linePointImageView.layer.borderColor = kThemeColor.CGColor;
    self.lineNameLabel.textColor = kContentColor;
    self.indexLabel.layer.cornerRadius = 8;
    self.indexLabel.clipsToBounds = YES;
    self.linePointImageView.clipsToBounds = YES;
    self.indexLabel.textColor = [UIColor whiteColor];
    self.indexLabel.backgroundColor = kThemeColor;
    self.indexLabel.layer.borderColor = [UIColor whiteColor].CGColor;
    self.indexLabel.layer.borderWidth = 1;
    
    self.maskView.alpha = 0.8;
    self.maskView.hidden = YES;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    if (_select ) {
        
        self.linePointImageView.layer.borderWidth = _select ? 3:0;
    }
}
- (void)setSelect:(BOOL)select {
    _select = select;
    
    self.linePointImageView.layer.borderWidth = _select ? 2:0;
}
- (void)configData:(ScenicPoint *)model {
    
    [self.linePointImageView setImageURL:[NSURL URLWithString:model.pictureArray.firstObject] placeholderImage:[UIImage imageNamed:@"placeholder_squ"]];
    
    self.indexLabel.text = [NSString stringWithFormat:@"%ld",model.number.integerValue];
    self.lineNameLabel.text = model.spotname;
    self.maskView.hidden = YES;
}

- (void)setPlayCellData:(ScenicPoint *)model {
    
    [self.linePointImageView setImageURL:[NSURL URLWithString:model.pictureArray.firstObject] placeholderImage:[UIImage imageNamed:@"placeholder_squ"]];
    
    self.indexLabel.text = [NSString stringWithFormat:@"%ld",model.number.integerValue];
    self.lineNameLabel.text = model.spotname;
    
    if (model.playpath.length > 0) {
        [RecordListDAO QueryRecordPlayPath:model.playpath Block:^(BOOL isContain) {
            
            self.record = isContain;
        }];
    }
}


- (void)setRecord:(BOOL)record {
    _record = record;
    
    if (record) {
        self.maskView.hidden = NO;
    }else {
        self.maskView.hidden = YES;
    }
}
@end
